Example #1
0
        protected void bindheader()
        {
            string str            = "";
            string Companyname    = Session["companyname"].ToString();
            string companyaddress = Session["companyaddress"].ToString();

            string headerstr = "<table width='100%'><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>";


            str = headerstr +
                  @"
            
            <tr><td colspan='7' width='70%'></td><td style='width:30%;border:solid 2px #1caf9a;text-align:right;'>
                <h3>
                    
Time & &nbsp;Expense Client Report
                </h3></td></tr><tr><td height='10'>&nbsp;</td></tr>
            

<tr><td  colspan='5' style='width:70%;'>
                <h2>
                   " + Companyname + @"
                </h2>
        </td><td colspan='2' align='right' style='font-size:11px;'>Printed on: " + GeneralMethod.getLocalDateTime() + @"</td></tr>
<tr><td colspan='7'>
                <h5>
                   " + companyaddress + @"
                </h5>
         </td></tr>
   <tr><td  colspan='7' height='10'>&nbsp;</td></tr></table>";


            Session["header"] = str;
            Session["css"]    = "timeexp";
        }
        protected void bindheader()
        {
            string str            = "";
            string Companyname    = Session["companyname"].ToString();
            string companyaddress = Session["companyaddress"].ToString();

            string headerstr = "<table width='100%'><tr><td></td><td></td><td></td><td></td><td></td></tr>";


            str = headerstr +
                  @"
            
            <tr><td colspan='2'></td><td  colspan='3' style='border:solid 2px #1caf9a;text-align:right;'>
                <h3>
                    
Time Summary by Project, Employee & Task
                </h3></td></tr><tr><td height='10'>&nbsp;</td></tr>
            

<tr><td  colspan='3' style='width:70%;'>
                <h2>
                   " + Companyname + @"
                </h2>
        </td><td colspan='2' align='right' style='font-size:11px;'>Printed on: " + GeneralMethod.getLocalDateTime() + @"</td></tr>
<tr><td colspan='5'>
                <h5>
                   " + companyaddress + @"
                </h5>
         </td></tr>
   <tr><td  colspan='5' height='10'>&nbsp;</td></tr><tr><td  colspan='5' height='10'>Time Entry Date: " + txtfromdate.Text + " to " + txttodate.Text + "</td></tr></table>";


            Session["header"] = str;
            Session["css"]    = "timeexp";
        }
        protected void bindheader()
        {
            string str            = "";
            string Companyname    = Session["companyname"].ToString();
            string companyaddress = Session["companyaddress"].ToString();

            string headerstr = "<table width='100%'>";


            str = headerstr +
                  @"
            
            <tr><td style='width:70%;'></td><td style='width:30%;border:solid 2px #1caf9a;'>
                <h3>
                    
Invoice List
                </h3></td></tr><tr><td height='10'>&nbsp;</td></tr>
            

<tr><td  style='width:70%;'>
                <h2>
                   " + Companyname + @"
                </h2>
        </td><td align='right' style='font-size:11px;'>Printed on: " + GeneralMethod.getLocalDateTime() + @"</td></tr>
<tr><td>
                <h5>
                   " + companyaddress + @"
                </h5>
         </td></tr>
   <tr><td  style='width:70%;' height='10'>&nbsp;</td><td  style='width:30%;'></td></tr></table>";


            Session["header"] = str;
            Session["css"]    = "invlist";
        }
        protected void createnewdirectory()
        {
            objfile.action = "insert";
            objfile.parent = hidparentid.Value;

            objfile.category = hidcategoryid.Value;

            objfile.loginid     = ViewState["driveid"].ToString();
            objfile.createdby   = Session["userid"].ToString();
            objfile.type        = ViewState["drive"].ToString();
            objfile.name        = txtdirname.Text;
            objfile.mName       = txtdirname.Text;
            objfile.nid         = "";
            objfile.dob         = GeneralMethod.getLocalDateTime();
            objfile.description = "Created by " + Session["userid"].ToString();
            objfile.companyid   = Session["companyId"].ToString();
            objfile.imgurl      = GeneralMethod.getfilicon("folder", "");
            //objfile.meetingid = hidid2.Value;
            objfile.linktype  = "folder";
            objfile.extension = "";
            ds = objfile.managefiles();
            txtdirname.Text = "";
            // hidparentid.Value = ds.Tables[0].Rows[0]["nid"].ToString();
            bindgrid();
            fillcategory();
        }
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            if (Session["email_empid"] == null || Session["email_empname"] == null || Session["email_sendername"] == null || Session["email_senderemail"] == null)
            {
                Response.Redirect("sessionexpired.html");
            }
            else
            {
                string datetime = DateTime.Now.ToFileTimeUtc().ToString();
                string fileid   = "";

                if (Session["file"] != null)
                {
                    tblfile = (DataTable)Session["file"];
                    if (tblfile.Rows.Count > 0)
                    {
                        try
                        {
                            objfile.action  = "saveFile";
                            objfile.dob     = GeneralMethod.getLocalDateTime();
                            objfile.nid     = "";
                            objfile.name    = Session["email_sendername"].ToString();
                            objfile.emailid = Session["email_senderemail"].ToString();
                            objfile.sentto  = Session["email_empid"].ToString();
                            ds = objfile.ManageEmailFileShare();
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                objfile.nid = ds.Tables[0].Rows[0]["nid"].ToString();
                                fileid      = ds.Tables[0].Rows[0]["filecode"].ToString();
                                for (int i = 0; i < tblfile.Rows.Count; i++)
                                {
                                    objfile.originalfile = tblfile.Rows[i]["originalname"].ToString();
                                    objfile.savedfile    = tblfile.Rows[i]["savename"].ToString();
                                    ds = objfile.ManageEmailFileShare();
                                }

                                hidcurfilesize.Value = "0";
                            }


                            if (sendemail(tblfile.Rows.Count, fileid))
                            {
                                Session["file"]    = null;
                                divfile.Visible    = false;
                                divmessage.Visible = true;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Error in Sending!');</script>", false);
                            }
                        }
                        catch
                        {
                            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Error in Sending!');</script>", false);
                            return;
                        }
                    }
                    else
                    {
                        Session["file"] = null;
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                        return;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                    return;
                }
            }
        }
Example #6
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            objda.nid    = hidid.Value;
            objda.code   = txtcode.Text;
            objda.Name   = txtCompany.Text;
            objda.action = "checkexists";
            ds           = objda.ManageCompany();
            if (ds.Tables[0].Rows.Count > 0)
            {
                txtcode.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Company code already exists');</script>", false);

                return;
            }
            objda.action        = "insert";
            objda.address       = txtaddress.Value;
            objda.cityId        = txtCity.SelectedItem.Text;
            objda.stateId       = txtState.SelectedItem.Text;
            objda.countryId     = txtCountry.SelectedItem.Text;
            objda.zip           = txtZip.Value;
            objda.phone         = txtphone.Value;
            objda.fax           = txtFax.Value;
            objda.contactPerson = txtcontactperson.Value;
            objda.email         = txtemail.Text;
            objda.website       = txtwebsite.Value;
            //imgurl used to Pass LogoURL value
            objda.imgurl = hidlogo.Value;
            //logoURL used to pass LogoIcon value
            objda.logoURL      = hidlogoicon.Value;
            objda.creationDate = GeneralMethod.getLocalDateTime();
            objda.symbol       = ddlcurrency.Text;
            ds = objda.ManageCompany();
            if (ds.Tables[0].Rows.Count > 0)
            {
                hidid.Value     = ds.Tables[0].Rows[0]["nid"].ToString();
                objda.action    = "checkexist";
                objda.loginid   = txtloginid.Value;
                objda.userType  = "admin";
                objda.companyId = hidid.Value;
                objda.nid       = hidempid.Value;
                objda.deptId    = "";
                objda.desigId   = "";

                ds = objda.ManageUser();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtloginid.Value = "";
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Login Id already exists');</script>", false);
                }
                objda.action    = "insert";
                objda.companyId = hidid.Value;
                objda.status    = "Active";
                objda.userid    = Session["adminid"].ToString();
                objda.fname     = txtfname.Value;
                objda.lname     = txtlname.Value;
                objda.loginid   = txtloginid.Value;
                objda.pass      = txtpassword.Text;
                ds = objda.ManageUser();
            }

            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Record saved successfully');</script>", false);

            bindgrid();
            blank();
        }
        protected void btnupload_Click(object sender, EventArgs e)
        {
            string datetime = DateTime.Now.ToFileTimeUtc().ToString();


            if (Session["file"] != null)
            {
                tblfile = (DataTable)Session["file"];
                if (tblfile.Rows.Count > 0)
                {
                    try
                    {
                        objfile.companyid   = Session["CompanyId"].ToString();
                        objfile.action      = "insert";
                        objfile.dob         = GeneralMethod.getLocalDateTime();
                        objfile.nid         = "";
                        objfile.description = "File uploaded by " + Session["userid"].ToString();
                        objfile.parent      = hidparentid.Value;
                        objfile.category    = "0";
                        for (int i = 0; i < tblfile.Rows.Count; i++)
                        {
                            objfile.name     = tblfile.Rows[i]["originalname"].ToString();;
                            objfile.mName    = tblfile.Rows[i]["savename"].ToString();
                            objfile.type     = ViewState["drive"].ToString();
                            objfile.linktype = "file";

                            objfile.imgurl    = GeneralMethod.getfilicon("file", tblfile.Rows[i]["ext"].ToString().ToUpper());
                            objfile.loginid   = ViewState["driveid"].ToString();
                            objfile.createdby = Session["userid"].ToString();
                            if (ViewState["drive"].ToString() == "meetingfile" || ViewState["drive"].ToString() == "shared")
                            {
                                objda.loginid = hidid2.Value;
                            }
                            //objfile.meetingid = hidid2.Value;
                            objfile.extension = tblfile.Rows[i]["ext"].ToString();
                            ds = objfile.managefiles();
                        }

                        bindgrid();
                        Session["file"] = null;
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>closepop('popupload');</script>", false);
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Error in Uploading');</script>", false);
                        return;
                    }
                }
                else
                {
                    Session["file"] = null;
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                    return;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File does not exist.');</script>", false);
                return;
            }
        }
        protected void dlfile_ItemCommand(object source, DataListCommandEventArgs e)
        {
            int i = e.Item.ItemIndex;

            if (e.CommandName == "select")
            {
                HtmlAnchor lbtn       = (HtmlAnchor)dlfile.Items[i].FindControl("lbtndir");
                LinkButton lbtnselect = (LinkButton)dlfile.Items[i].FindControl("lbtnselect");
                if (lbtnselect.Text == "Select")
                {
                    hidselect.Value = hidselect.Value + "#" + e.CommandArgument.ToString();
                    //bindgrid();
                    lbtn.Attributes.Add("Class", "active");
                    lbtnselect.Text = "Unselect";
                }
                else
                {
                    hidselect.Value = hidselect.Value.ToString().Replace("#" + e.CommandArgument.ToString(), "");

                    lbtn.Attributes.Add("Class", "");
                    lbtnselect.Text = "Select";
                }
            }
            if (e.CommandName == "open")
            {
                HtmlInputHidden hidtype = (HtmlInputHidden)dlfile.Items[i].FindControl("hidlinktype");
                if (hidtype.Value == "folder")
                {
                    hidparentid.Value  = e.CommandArgument.ToString();
                    hidid2.Value       = ((HtmlInputHidden)dlfile.Items[i].FindControl("hidloginid")).Value;
                    issearch           = false;
                    txtsearchfile.Text = "";

                    bindgrid();
                }
                else
                {
                    objfile.nid       = e.CommandArgument.ToString();
                    objfile.action    = "selectfile";
                    objfile.loginid   = ViewState["driveid"].ToString();
                    objfile.createdby = Session["userid"].ToString();
                    objfile.dob       = GeneralMethod.getLocalDateTime();
                    ds = objfile.managefiles();

                    if (!objexcel.downloadVirturalfile(ds.Tables[0].Rows[0]["uploadfilename"].ToString(), ds.Tables[0].Rows[0]["originalfilename"].ToString(), "webfile/" + Session["companyid"].ToString()))
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('File is not available or temporarily removed.');</script>", false);
                        return;
                    }
                }
            }
            if (e.CommandName == "detail")
            {
                objfile.nid       = e.CommandArgument.ToString();
                objfile.action    = "selectfile";
                objfile.loginid   = ViewState["driveid"].ToString();
                objfile.createdby = Session["userid"].ToString();
                objfile.dob       = GeneralMethod.getLocalDateTime();
                objfile.companyid = Session["companyid"].ToString();
                ds = objfile.managefiles();

                if (ds.Tables[0].Rows.Count > 0)
                {
                    tdcreatedby.InnerHtml            = "Created by: " + ds.Tables[0].Rows[0]["name"].ToString();
                    tdcreationdate.InnerHtml         = "Creation date: " + ds.Tables[0].Rows[0]["adddate"].ToString();
                    tdlastmodificationdate.InnerHtml = "Modification date: " + ds.Tables[0].Rows[0]["modificationdate"].ToString();
                    //tdshareto.InnerHtml = "<b>Shared to:</b> " + ds.Tables[0].Rows[0]["sharedetail"].ToString();
                    if (ds.Tables[0].Rows[0]["linktype"].ToString() == "folder")
                    {
                        tdfilename.InnerHtml = "Directory Name: " + ds.Tables[0].Rows[0]["originalfilename"].ToString();
                    }
                    else
                    {
                        tdfilename.InnerHtml = "File Name: " + ds.Tables[0].Rows[0]["originalfilename"].ToString();
                    }

                    if (ds.Tables[0].Rows[0]["shareto"].ToString() != "")
                    {
                        divaccessdetail.Visible = true;
                        if (ds.Tables[1].Rows.Count > 0)
                        {
                            repdetail.Visible    = true;
                            repdetail.DataSource = ds.Tables[1];
                            repdetail.DataBind();
                        }
                        else
                        {
                            repdetail.Visible = false;
                        }
                    }
                    else
                    {
                        divaccessdetail.Visible = false;
                    }

                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>openpop('popdetail');</script>", false);
                }
            }
            if (e.CommandName == "share")
            {
                hidfileid.Value = e.CommandArgument.ToString();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>openpop('popshareuser');</script>", false);
            }
            if (e.CommandName == "edit")
            {
                dlfile.EditItemIndex = e.Item.ItemIndex;
                bindgrid();
            }
            if (e.CommandName == "delete")
            {
                objfile.nid          = e.CommandArgument.ToString();
                objfile.action       = "delete";
                dlfile.EditItemIndex = -1;
                ds = objfile.managefiles();
                bindgrid();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'> alert('Deleted Successfully');</script>", false);
            }
            if (e.CommandName == "saverename")
            {
                objfile.nid          = e.CommandArgument.ToString();
                objfile.name         = ((TextBox)dlfile.Items[i].FindControl("txtrename")).Text;
                objfile.action       = "rename";
                ds                   = objfile.managefiles();
                dlfile.EditItemIndex = -1;
                bindgrid();
            }
            if (e.CommandName == "resetrename")
            {
                dlfile.EditItemIndex = -1;
                bindgrid();
            }
        }