public static string GetPreviousYr1(string date) // Previous Date In English from Nepali Date
    {
        string[] dateint = new string[3];
        int[]    date1   = new int[3];
        dateint = date.Split('/');
        if (int.Parse(dateint[1]) < 4)
        {
            date1[0] = 4;
            date1[1] = 1;
            date1[2] = int.Parse(dateint[0]) - 1;
        }
        else
        {
            date1[0] = 4;
            date1[1] = 1;
            date1[2] = int.Parse(dateint[0]);
        }
        string date2 = ConvertNE.ConvertNToE(date1);

        return(date2);
    }
        private void GetCompanyInfo(string CompanyCode)
        {
            DataTable dt = BL_CompanyInfoDrose.GetCompanyInfo(1, "", CompanyCode, System.DateTime.Now);

            if (dt.Rows.Count > 0)
            {
                lblCode.Text        = CompanyCode;
                lblCompanyName.Text = dt.Rows[0]["CompanyName"].ToString();
                //txtRegistrationNo.Text = "";
                //txtRegistrationNo.Enabled = false;
                txtPanNo.Text       = DESDecrypt(dt.Rows[0]["PanNo"].ToString());
                txtCountry.Text     = DESDecrypt(dt.Rows[0]["Country"].ToString());
                txtState.Text       = DESDecrypt(dt.Rows[0]["State"].ToString());
                txtCity.Text        = DESDecrypt(dt.Rows[0]["City"].ToString());
                txtAddress1.Text    = DESDecrypt(dt.Rows[0]["Adress1"].ToString());
                txtAddress2.Text    = DESDecrypt(dt.Rows[0]["Adress2"].ToString());
                txtTelephoneNo.Text = DESDecrypt(dt.Rows[0]["TelephoneNo"].ToString());
                // DESDecrypt(dt.Rows[0]["Logo"].ToString());
                txtEmailAddress.Text = DESDecrypt(dt.Rows[0]["EmailAdress"].ToString());
                txtWebAddress.Text   = DESDecrypt(dt.Rows[0]["WebAdress"].ToString());
                //DESDecrypt(dt.Rows[0]["C1"].ToString());
                //DESDecrypt(dt.Rows[0]["C2"].ToString());
                //  DESDecrypt(dt.Rows[0]["MC"].ToString());
                txtDate.Text = ConvertNE.ConvertEToNWithSlash(Convert.ToDateTime(DESDecrypt(dt.Rows[0]["Created_Date"].ToString())));

                // DESDecrypt(dt.Rows[0]["DATABASE_NAME"].ToString());

                //DESDecrypt(dt.Rows[0]["PWD"].ToString());
                txtImagesDrive.Text = dt.Rows[0]["IMAGES_DRIVE"].ToString();

                txtContactPersonName.Text = dt.Rows[0]["CONTACT_PERSON_NAME"].ToString();
                txtTelNo.Text             = dt.Rows[0]["C_TEL_NO"].ToString();
                txtMobNo.Text             = dt.Rows[0]["MOB_NO"].ToString();
                txtContactAddress.Text    = dt.Rows[0]["C_ADDRESS"].ToString();
                txtEmailAdd.Text          = dt.Rows[0]["EMAIL_ADDRESS"].ToString();
                txtNostroAcNCB.Text       = dt.Rows[0]["NOSTRO_AC_NCB"].ToString();
                txtMirrorNCB.Text         = dt.Rows[0]["MIRROR_AC_NCB"].ToString();
                txtMirrorNCB.Text         = dt.Rows[0]["MIRROR_AC_DROSE"].ToString();
            }
        }
Beispiel #3
0
    /**
     * Calculates wheather english year is leap year or not
     *
     * @param integer $year
     * @return boolean
     */
    public static string GetDefaultYearMonthDays(string yearMonthDays)
    {
        string nepdate = ConvertNE.ConvertEToNWithSlash(BK_Session.GetSession().OpDate);

        string[] nepdatearray = nepdate.Split('/');
        string   year         = nepdatearray[0].ToString();
        string   month        = nepdatearray[1].ToString();
        string   days         = nepdatearray[2].ToString();

        if (yearMonthDays.ToLower() == "year")
        {
            if (Convert.ToInt16(month) >= 4)
            {
            }
            else
            {
                year = (Convert.ToInt16(year) - 1).ToString();
            }
            return(year);
        }
        else if (yearMonthDays.ToLower() == "month")
        {
            return(month);
        }
        else if (yearMonthDays.ToLower() == "days")
        {
            return(days);
        }
        else if (yearMonthDays.ToLower() == "nepDate")
        {
            return(nepdate);
        }
        else
        {
            return(nepdate);
        }
    }
 public static string GetWeekOpening(int yr, int month, int Week) //Returns Month Opening Date in English
 {
     int[] nepaliDate = new int[3];
     nepaliDate[0] = month;
     nepaliDate[1] = 1;
     nepaliDate[2] = yr;
     if (Week == 1)
     {
         nepaliDate[1] = 1;
     }
     else if (Week == 2)
     {
         nepaliDate[1] = 8;
     }
     else if (Week == 3)
     {
         nepaliDate[1] = 15;
     }
     else
     {
         nepaliDate[1] = 22;
     }
     return(ConvertNE.ConvertNToE(nepaliDate));
 }
Beispiel #5
0
    public static string ConvertEToNWithSlash(DateTime eDate)
    {
        string    nnDate = "";
        ConvertNE ne     = new ConvertNE();

        if (ne.is_range_eng(eDate))
        {
            // english month data.
            int[] month  = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
            int[] lmonth = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

            //DateTime def_eyy = new DateTime(1944,1,1);
            int def_eyy = 1944;
            //spear head english date...
            DateTime def_nyy = new DateTime(2000, 9, 17 - 1);
            //$def_nyy = 2000; $def_nmm = 9; $def_ndd = 17-1;		//spear head nepali date...

            int total_eDays = 0; int total_nDays = 0; int a = 0; int day = 7 - 1;               //all the initializations...
            int m = 0; int y = 0; int i = 0; int j = 0;
            int numDay = 0;

            // count total no. of days in-terms of year
            for (int x = 0; x < (eDate.Year - def_eyy); x++)
            {   //total days for month calculation...(english)
                if (is_leap_year(def_eyy + x))
                {
                    for (int w = 0; w < 12; w++)
                    {
                        total_eDays += lmonth[w];
                    }
                }
                else
                {
                    for (int z = 0; z < 12; z++)
                    {
                        total_eDays += month[z];
                    }
                }
            }

            // count total no. of days in-terms of month
            for (int p = 0; p < (eDate.Month - 1); p++)
            {
                if (is_leap_year(eDate.Year))
                {
                    total_eDays += lmonth[p];
                }
                else
                {
                    total_eDays += month[p];
                }
            }

            // count total no. of days in-terms of date
            total_eDays += eDate.Day;
            i            = 0; j = def_nyy.Month;
            total_nDays  = def_nyy.Day;
            m            = def_nyy.Month;
            y            = def_nyy.Year;

            // count nepali date from array
            while (total_eDays != 0)
            {
                a = ne.bs[i, j];
                total_nDays++;                                          //count the days
                day++;                                                  //count the days interms of 7 days
                if (total_nDays > a)
                {
                    m++;
                    total_nDays = 1;
                    j++;
                }
                if (day > 7)
                {
                    day = 1;
                }
                if (m > 12)
                {
                    y++;
                    m = 1;
                }
                if (j > 12)
                {
                    j = 1; i++;
                }
                total_eDays--;
            }

            numDay = day;
            if (m.ToString().Length == 1)
            {
                nnDate = y + "/0" + m;
            }
            else
            {
                nnDate = y + "/" + m;
            }
            if (total_nDays.ToString().Length == 1)
            {
                nnDate = nnDate + "/0" + total_nDays;
            }
            else
            {
                nnDate = nnDate + "/" + total_nDays;
            }
        }
        return(nnDate);
    }
Beispiel #6
0
    // * currently can only calculate the date between BS 2000-2089
    // */
    public static string ConvertNToE(int[] nn)
    {
        string    eeDate = "";
        ConvertNE ne = new ConvertNE();
        DateTime  def_eyy = new DateTime(1943, 4, 14 - 1);
        DateTime  def_nyy = new DateTime(2000, 1, 1);                               // equivalent nepali date.
        int       total_eDays = 0; int total_nDays = 0; int a = 0; int day = 4 - 1; // initializations...
        int       m = 0; int y = 0;
        //int i = 0;
        int k = 0;

        int[] month  = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
        int[] lmonth = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

        if (ne.is_range_nep(nn))
        {
            // count total days in-terms of year
            for (int u = 0; u < (nn[2] - def_nyy.Year); u++)
            {
                for (int v = 1; v <= 12; v++)
                {
                    total_nDays += ne.bs[k, v];
                }
                k++;
            }

            // count total days in-terms of month
            for (int p = 1; p < nn[0]; p++)
            {
                total_nDays += ne.bs[k, p];
            }

            // count total days in-terms of dat
            total_nDays += nn[1];

            //calculation of equivalent english date...
            total_eDays = def_eyy.Day;
            m           = def_eyy.Month;
            y           = def_eyy.Year;
            while (total_nDays != 0)
            {
                if (is_leap_year(y))
                {
                    a = lmonth[m - 1];
                }
                else
                {
                    a = month[m - 1];
                }
                total_eDays++;
                day++;
                if (total_eDays > a)
                {
                    m++;
                    total_eDays = 1;
                    if (m > 12)
                    {
                        y++;
                        m = 1;
                    }
                }
                if (day > 7)
                {
                    day = 1;
                }
                total_nDays--;
            }
            eeDate = y + "-" + m + "-" + total_eDays;
        }
        return(eeDate);
    }
 private void ViewDetails(string invoiceNo)
 {
     mpeDetails.Show();
     lblInvoiceNo.Text           = invoiceNo;
     gvOrderedDetails.DataSource = BllImportExcel.GetImportListByDate(4, int.Parse(ddlBranch.SelectedValue), ddlSeason.SelectedValue, invoiceNo, DateTime.Parse(ConvertNE.ConvertNToE(DateStringToInt.StringToInt(txtDate.Text))));
     gvOrderedDetails.DataBind();
 }
 public void FillGridView()
 {
     gvOrderList.DataSource = BllImportExcel.GetImportListByDate(3, int.Parse(ddlBranch.SelectedValue), ddlSeason.SelectedValue, "", DateTime.Parse(ConvertNE.ConvertNToE(DateStringToInt.StringToInt(txtDate.Text))));
     gvOrderList.DataBind();
 }
        private void InsUpdDelCompanyInfo(char Event, string Id)
        {
            try
            {
                BL_CompanyInfoDrose obj = new BL_CompanyInfoDrose();
                string CompanyName      = txtCompanyName.Text;
                string CompanyName1     = CompanyName.Substring(0, 10);
                int    cc           = CompanyName.Length - 10;
                string CompanyName2 = CompanyName.Substring(10, cc);
                obj.EVENT = Event;
                obj.Co_ID = 0;
                if (Event == 'I' || Event == 'U')
                {
                    obj.CompanyName     = txtCompanyName.Text;
                    obj.RegistrationNo  = txtRegistrationNo.Text;
                    obj.PanNo           = (txtPanNo.Text);
                    obj.Country         = (txtCountry.Text);
                    obj.State           = (txtState.Text);
                    obj.City            = (txtCity.Text);
                    obj.Adress1         = (txtAddress1.Text);
                    obj.Adress2         = (txtAddress2.Text);
                    obj.TelephoneNo     = (txtTelephoneNo.Text);
                    obj.EmailAdress     = (txtEmailAddress.Text);
                    obj.WebAdress       = (txtWebAddress.Text);
                    obj.C1              = (CompanyName1);
                    obj.C2              = (CompanyName2);
                    obj.MC              = "";
                    obj.Created_Date    = (ConvertNE.convertNepaliToEnglish(txtDate.Text).ToString());
                    obj.COMPANY_CODE    = Id;
                    obj.ADMIN_USER_NAME = (txtUserName.Text);
                    obj.PWD             = (txtPassword.Text);
                    obj.IMAGES_DRIVE    = txtImagesDrive.Text;


                    obj.CONTACT_PERSON_NAME = txtContactAddress.Text;
                    obj.EMAIL_ADDRESS       = txtEmailAdd.Text;
                    obj.MIRROR_AC_DROSE     = txtMirrorDrose.Text;
                    obj.MIRROR_AC_NCB       = txtMirrorNCB.Text;
                    obj.NOSTRO_AC_NCB       = txtNostroAcNCB.Text;
                    obj.MOB_NO    = txtMobNo.Text;
                    obj.C_ADDRESS = txtContactAddress.Text;
                    obj.C_TEL_NO  = txtTelNo.Text;
                }
                string msg = obj.InsUpdDelCompanyInfo(out Id);
                if (msg == "Record Inserted Successfully" || msg == "Record Updated Successfully" || msg == "Record Deleted Successfully")
                {
                    string path = txtImagesDrive.Text + Id.ToString();
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    string p = picUpload(FileUpload1, path);
                    if (p == "url")
                    {
                        p = "nophoto.gif";
                    }

                    //Check Info In Company Code
                    // BL_CompanyInfoDrose.
                    msgbox.ShowSuccess(msg);
                    Response.Redirect("~/Common/OrganizationList.aspx");
                    ExecuteQuery(Id);
                    Clear();
                }
                else
                {
                    msgbox.ShowWarning(msg);
                }
            }
            catch (Exception ex)
            {
                msgbox.ShowWarning(ex.Message);
            }
        }
Beispiel #10
0
 private void ViewDetails(string orderedId)
 {
     mpeDetails.Show();
     lblOrderNo.Text             = orderedId;
     gvOrderedDetails.DataSource = BL_OrderedExcel.GetOrderedListByDate(3, int.Parse(ddlBranch.SelectedValue), ddlSeason.SelectedValue, orderedId.ToString(), DateTime.Parse(ConvertNE.ConvertNToE(DateStringToInt.StringToInt(txtDate.Text))));
     gvOrderedDetails.DataBind();
 }